import request from '@/utils/request'
// usedfor:使用平台, 1:运管系统采购下单，2：采购平台总部下单，3：采购平台总部统配

// 礼品采购下单礼品列表总分页数
export function getGiftPageSize(data, usedfor) {
    let url = '';
    if (usedfor == 1) {
        url = '/Purchase_gift/gift_page';
    } else if (usedfor == 2) {
        url = '/Ims_purchase_gift/ims_gift_page';
    } else if (usedfor == 3) {
        url = '/ims_store_purchase_gift/gift_page';
    } else {
        console.log("error: usedfor is undefined", "zst getGiftPageSize");
        return;
    }
    return request({
        url: url,
        method: 'post',
        data: data
    })
}
// 礼品采购下单礼品列表数据
export function getGiftList(data, page, usedfor) {
    let url = '';
    if (usedfor == 1) {
        url = '/Purchase_gift/gift_list/';
    } else if (usedfor == 2) {
        url = '/Ims_purchase_gift/ims_gift_list/';
    } else if (usedfor == 3) {
        url = '/ims_store_purchase_gift/gift_list/';
    } else {
        console.log("error: usedfor is undefined", "zst getGiftList");
        return;
    }
    return request({
        url: url + (page ? page : 1),
        method: 'post',
        data: data
    })
}
// 礼品采购下单，添加购物车，
// 参数：添加购物车用shop_num，修改购物车用now_num
export function addToCart(data, usedfor) {
    let url = '';
    if (usedfor == 1) {
        url = '/Purchase_gift/add_gift_cars';
    } else if (usedfor == 2) {
        url = '/Ims_purchase_gift/ims_add_gift_cars';
    } else if (usedfor == 3) {
        url = '/ims_store_purchase_gift/add_gift_cars';
    } else {
        console.log("error: usedfor is undefined", "zst addToCart");
        return;
    }
    return request({
        url: url,
        method: 'post',
        data: data
    })
}
// 礼品采购下单，修改购物车，
// 参数：添加购物车用shop_num，修改购物车用now_num
export function editCart(data, usedfor) {
    let url = '';
    if (usedfor == 1) {
        url = '/Purchase_gift/add_gift_cars';
    } else if (usedfor == 2) {
        url = '/Ims_purchase_gift/ims_add_gift_cars';
    } else if (usedfor == 3) {
        url = '/ims_store_purchase_gift/add_gift_cars';
    } else {
        console.log("error: usedfor is undefined", "zst addToCart");
        return;
    }
    return request({
        url: url,
        method: 'post',
        data: data
    })
}
// 获取购物车中礼品种类数
export function cartSize(data, usedfor) {
    let url = '';
    if (usedfor == 1) {
        url = '/Purchase_gift/get_gift_cars_count';
    } else if (usedfor == 2) {
        url = '/Ims_purchase_gift/get_gift_cars_count';
    } else if (usedfor == 3) {
        url = '/ims_store_purchase_gift/get_gift_cars_count';
    } else {
        console.log("error: usedfor is undefined", "zst cartSize");
        return;
    }
    return request({
        url: url,
        method: 'post',
        data: data
    })
}
// 获取供应商信息
export function getSupplier(data) {
    return request({
        url: '/Ims_supplier/get_supplier',
        method: 'post',
        data: data
    })
}
// 获取对接人信息
export function getDocking() {
    return request({
        url: '/Operations_docking_people/docking_list',
        method: 'post',
        data: ''
    })
}

